﻿using System.Collections.Generic;
using FileSecurityManager.BizEntities;

namespace FileSecurityManager.DataAccess.Interfaces
{
    public interface IRepository<T> where T : BaseModel
    {
        /// <summary>
        /// Creates the specified model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>Item model</returns>
        T Create(T model);

        /// <summary>
        /// Gets the model by id.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns>Item model</returns>
        T GetById(int id);

        /// <summary>
        /// Gets model by name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns>The model</returns>
        T GetByName(string name);

        /// <summary>
        /// Updates the specified model.
        /// </summary>
        /// <param name="model">The model.</param>
        void Update(T model);

        /// <summary>
        /// Deletes the specified id.
        /// </summary>
        /// <param name="id">The identifier.</param>
        void Delete(int id);

        /// <summary>
        /// Gets all models.
        /// </summary>
        /// <returns>All models list</returns>
        List<T> GetAll();
    }
}
